import QuestionInput from './QuestionInput'
import QuestionRadio from './QuestionRadio'
import QuestionInfo from './QuestionInfo'
import QuestionTitle from './QuestionTitle'
import QuestionParagraph from './QuestionParagraph'
import QuestionTextArea from './QuestionTextArea'
import QuestionCheckbox from './QuestionCheckbox'
type ComponentInfoType = {
    fe_id: string;
    type: string;
    title: string;
    isHidden: string;
    props: any;
}

export const getComponent = (component: ComponentInfoType) => {
    const {fe_id, type, isHidden, props} = component;
    if(isHidden) {
        return null;
    }

    switch (type) {
        case "questionInput":
            return <QuestionInput fe_id={fe_id} props={props}/>;
       case "questionRadio":
            return <QuestionRadio fe_id={fe_id} props={props}/>;
        case "questionInfo":
            return <QuestionInfo {...props}/>;
        case "questionTitle":
            return <QuestionTitle {...props} />;
        case "questionParagraph":
            return <QuestionParagraph {...props}/>;
        case "questionTextArea":
            return <QuestionTextArea fe_id={fe_id} props={props}/>;
        case "questionCheckbox":
            return <QuestionCheckbox fe_id={fe_id} props={props}/>;

    }
}